Remove /clr:pure from WPF C++/CLI projects#11575
Conversation
Migrate DirectWriteForwarder and System.Printing from /clr:pure to /clr:netcore (IJW mixed mode) in preparation for MSVC 14.51 which removes /clr:pure + /clr:netcore support. Changes: - CLRSupport and CompileAsManaged changed from pure to NetCore - Removed pure to NetCore conversion logic in Wpf.Cpp.props - Removed ijwhost.dll packaging exclusion (required for mixed-mode) - Added _M_ARM64 to architecture check in intsafe_private_copy.h Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Updates WPF’s C++/CLI build configuration to remove reliance on deprecated /clr:pure in favor of standard /clr:netcore (IJW mixed mode), aligning with upcoming MSVC toolset behavior and unblocking future builds.
Changes:
- Switched
CLRSupportandCompileAsManagedfrompuretoNetCoreforDirectWriteForwarderandSystem.Printing. - Simplified
Wpf.Cpp.propsby removing thepure→NetCoreremapping logic and updatingManagedCxxconditions. - Fixed an ARM64 compilation break by extending architecture detection in
intsafe_private_copy.h.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/Microsoft.DotNet.Wpf/src/System.Printing/System.Printing.vcxproj | Moves the project to /clr:netcore and allows ijwhost.dll to be packaged by removing the exclusion. |
| src/Microsoft.DotNet.Wpf/src/DirectWriteForwarder/DirectWriteForwarder.vcxproj | Moves the project to /clr:netcore and allows ijwhost.dll to be packaged by removing the exclusion. |
| src/Microsoft.DotNet.Wpf/src/DirectWriteForwarder/CPP/TrueTypeSubsetter/TtfDelta/intsafe_private_copy.h | Adds _M_ARM64 handling to prevent ARM64 build errors. |
| eng/WpfArcadeSdk/tools/Wpf.Cpp.props | Updates shared build logic to recognize CLRSupport=NetCore and removes the old pure remap. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Can we have some link/reference to the deprecation of the combination? |
Agent-Logs-Url: https://github.com/dotnet/dotnet/sessions/85dfa847-a6bb-4471-863f-64e56545c584 Co-authored-by: jkotas <6668460+jkotas@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Please refer to this page /clr:pure is deprecated. The option is removed in Visual Studio 2017 and later. We recommend that you port code that must be pure MSIL to C#. The driver also gives a deprecation warning if /clr:pure is used: cl : Command line warning D9035 : option 'clr:pure' has been deprecated and will be removed in a future release |
@dotnet-policy-service agree company="Microsoft" |
Address PR review nit: remove CLRSupport=='pure' from DllRenameClause condition since no project sets CLRSupport to 'pure' anymore. Update comment to reference /clr:netcore instead of /clr:pure. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
…otnet-wpf-int build 20260512.2 On relative base path root Microsoft.DotNet.Wpf.DncEng From Version 11.0.0-preview.2.26165.1 -> To Version 11.0.0-preview.2.26262.2
After the /clr:pure to /clr:NetCore migration (dotnet/wpf#11575), DirectWriteForwarder and System.Printing became mixed-mode C++/CLI assemblies that require ijwhost.dll at runtime. The DLL was being placed in the managed lib/ folder where it is not recognized by RuntimeList.xml, causing it to be missing from self-contained publish output. Move ijwhost.dll packaging logic to Packaging.targets centrally: exclude it from the lib/ folder and route it to runtimes/win-{arch}/native/ so it is properly included in the runtime pack manifest. Fixes dotnet/wpf#11651 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The previous approach tried to include ijwhost.dll from the WPF C++/CLI project output directories, but classic vcxproj files don't produce ijwhost.dll in their output (the .NET SDK's UseIJWHost mechanism only works for SDK-style projects). Instead, source ijwhost.dll directly from the Microsoft.NETCore.App.Host pack (where it is built by the runtime repo) and include it as a NativeRuntimeAsset in the WindowsDesktop shared framework runtime pack. This ensures it is present at runtime for the mixed-mode C++/CLI assemblies (DirectWriteForwarder.dll, System.Printing.dll) that depend on it after the /clr:pure to /clr:netcore migration (dotnet/wpf#11575). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Package ijwhost.dll as native asset for self-contained publish After the /clr:pure to /clr:NetCore migration (#11575), DirectWriteForwarder and System.Printing became mixed-mode C++/CLI assemblies that require ijwhost.dll at runtime. The DLL was being placed in the managed lib/ folder where it is not recognized by RuntimeList.xml, causing it to be missing from self-contained publish output. Exclude ijwhost.dll from the lib/ packaging and add it as a native asset under runtimes/win-{arch}/native/ so it is properly included in the runtime pack manifest. Fixes #11651 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Move ijwhost.dll packaging logic to Packaging.targets Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Description
MSVC 14.51 (VS 18.3) is removing support for
/clr:purewhen used with/clr:netcore. WPF is the only known consumer of/clr:pure. This PR migrates the two affected C++/CLI projects (DirectWriteForwarder.vcxprojandSystem.Printing.vcxproj) from/clr:pureto standard/clr:netcore(IJW mixed mode).Changes:
CLRSupportandCompileAsManagedfrompuretoNetCorein both vcxproj filesWpf.Cpp.propsto remove thepuretoNetCoreconversion logic inManagedCxxconditionsijwhost.dllfrom packaging exclusions in both vcxproj files — mixed-mode assemblies require this .NET runtime bootstrap shim to load correctlyintsafe_private_copy.hwhere_M_ARM64was missing from an architecture detection#ifcondition (previously masked by_M_CEE_PURE)Customer Impact
Without this fix, WPF will fail to build with MSVC 14.51+ (VS 18.3) since
/clr:pure+/clr:netcorewill no longer be a valid combination. This is a build-time breaking change from the MSVC toolset.Regression
No. This is a proactive change to address an upcoming MSVC toolset deprecation. No existing behavior is regressed — the output DLLs function identically at runtime.
Testing
Risk
Low-Medium. The change is minimal (4 files) and surgical — it only affects the two C++/CLI projects in WPF. The runtime behavior of the DLLs is functionally equivalent; the difference is the compilation mode (pure MSIL → IJW mixed mode). The primary risk is potential performance impact from losing ahead-of-time MSIL compilation.
Microsoft Reviewers: Open in CodeFlow